package cn.cloudtogo.common.types;

import cn.cloudtogo.common.Assert;
import lombok.Data;

/**
 * @author yaolianhua789@gmail.com
 **/
@Data
public class Endpoint {
    private String host;
    private Integer port;

    public static Endpoint of(String host, Integer port) {
        Assert.argument(host != null && !host.isEmpty(), () -> "host is null");
        Assert.argument(port != null, () -> "port is null");
        Endpoint endpoint = new Endpoint();

        endpoint.setHost(host);
        endpoint.setPort(port);

        return endpoint;
    }
}
